<template>
  <su-page bg="#f7f7f7">
    <su-body>
      <!-- header -->
      <su-white-header v-if="detailData" :title="detailData.xmmc" :prop="detailData.createTime"></su-white-header>
      <!-- detail -->
      <su-prop-group title="签到详细信息" v-if="detailData">
        <su-prop label="项目经理">{{detailData.xmjl || ''}}</su-prop>
        <su-prop label="签到时间">{{detailData.qdrq || ''}}</su-prop>
        <su-prop label="联系方式">{{detailData.lxfs}}</su-prop>
        <su-prop label="项目地址">{{detailData.xmdz}}</su-prop>
        
      </su-prop-group>
	  <su-prop-group title="现场照片">
	  <su-prop-group  v-for="(item,index) in arr">
	     <image lazy-load class="su-fit-image" :src="item.src" mode="aspectFill" @click="previewImg(item.src)"></image>
	  </su-prop-group>
	     </su-prop-group>
      <!-- loading -->
      <su-list-loading :loading="detailLoading"></su-list-loading>
    </su-body>
  </su-page>
</template>

<script>
  /**
   * @description 详情
   * @date 2022-03-12
   * @version v1.0.1
   * @author gf
   */
  import {
    mapState
  } from 'vuex'
  import {runSQL} from '@/common/utils/wxutils.js'
  export default {
    data() {
      return {
        id:'',
		arr: null,
        detailData: null,
        detailLoading: false
      }
    },
    computed: {
      ...mapState(['token'])
    },
    onLoad(params) {
      this.id = params.id || ''
	  console.log("aaaaaaaaa",params.id);  
      this.getDetail(params.id)
    },
    watch: {
      token(newVal) {
        this.getDetail()
      }
    },
    methods: {
      // 获取详情
      getDetail(a) {
		  uni.request({
		      url:'http://120.221.95.208:8083/HdzjAppport/selqdtp?recid='+a,
		      method:'get',
		      success:res=>{
		          console.log(res.data);
		          if(res.data.length>0){
		  					  let list=[];
		  					  for(let i=0;i<res.data.length;i++){
		  						  let ai="data:image/jpeg;base64,"+res.data[i];
		  						  list.push({
		  							   src:ai
		  						  })
		  					  }
		  					  this.arr=list;
		  				
		  				  }
		      }
		  })

		   runSQL("select * from wsqd where recid="+a+";").then(res=>{
			   this.detailLoading = true
			   setTimeout(() => {
			     this.detailLoading = false
			     this.detailData = {
			       image: 'https://gd-hbimg.huaban.com/94e5cb3568c4d611aac4c7b56c12d4ba66f2567520c55-NZXOlZ_fw480',
				   xmjl: res[0][0].XMJL,
			       xmmc: res[0][0].XMMC,
			       qdrq: res[0][0].QDRQ,
			       lxfs: res[0][0].LXFS,
			       xmdz: res[0][0].XMDZ
			      
			     }
			   }, 300)
			   
		   })
       
      }
    },
  }
</script>

<style lang="scss">
</style>
